package cn.iocoder.yudao.module.peizhen.controller.app.project;

import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;

import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;

import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;

import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;

import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;

import cn.iocoder.yudao.module.peizhen.controller.app.project.vo.*;
import cn.iocoder.yudao.module.peizhen.dal.dataobject.project.ProjectDO;
import cn.iocoder.yudao.module.peizhen.service.project.ProjectService;

@Tag(name = "用户 APP - 服务项目")
@RestController
@RequestMapping("/peizhen/project")
@Validated
public class AppProjectController {

    @Resource
    private ProjectService projectService;


    @GetMapping("/get")
    @Operation(summary = "获得服务项目")
    @Parameter(name = "id", description = "编号", required = true, example = "1024")
    public CommonResult<AppProjectRespVO> getProject(@RequestParam("id") Integer id) {
        ProjectDO project = projectService.getProject(id);
        return success(BeanUtils.toBean(project, AppProjectRespVO.class));
    }

    @GetMapping("/list")
    @Operation(summary = "获得服务项目分页")
    public CommonResult<List<AppProjectRespVO>> getProjectPage(@Valid AppProjectPageReqVO pageReqVO) {
        List<ProjectDO> result = projectService.getProjectList(pageReqVO);
        return success(BeanUtils.toBean(result, AppProjectRespVO.class));
    }



}